package com.xiaohua.tlgorders.controller;


import com.xiaohua.tlgorders.entity.Address;
import com.xiaohua.tlgorders.service.AddressService;
import com.xiaohua.tlgorders.tools.Record;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AddressController {
    @Autowired
    private AddressService addressService;

    @GetMapping("/selAddress")
    public Record selAllAddress(Integer userId){
        return addressService.selAddress(userId);
    }

    @PostMapping("/addAddress")
    public Record addAddress(Address address){
        return addressService.addAddress(address);
    }

    @PostMapping("/delAddress")
    public Record delete(Integer addressId){
        return addressService.deleteAddress(addressId);
    }

    @PostMapping("/modifyAddress")
    public Record modifyAddress(Address address){
        return addressService.modifyAddress(address);
    }
}
